Skip to contentSkip to conversation

Change in openvpn[master]: ssl: Change update argument of compute_earliest_wakeup to time_t

Openvpn-devel In review flichtenheld (Code Review) 2 participants 7 messages Oct 24, 2025 – Nov 16, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1761324750000.I6bc3147d10ca50291110335cd9fc3be961280c1b@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1299?usp=email

to review the following change.

Change subject: ssl: Change update argument of compute_earliest_wakeup to time_t
......................................................................

ssl: Change update argument of compute_earliest_wakeup to time_t

Since we usually input a diff of two time_t values here the input value will be officially time_t. So avoid conversion warnings at almost every caller site.

We can safely cast it to interval_t here because we checked that it is smaller than the interval_t value earliest. And all negative values are treated equal, so exact value doesn't matter.

Change-Id I6bc3147d10ca50291110335cd9fc3be961280c1b

---
M src/openvpn/ssl.c

1 file changed, 7 insertions(+), 7 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/99/1299/1

src/openvpn/ssl.c +7 -7
index 54b69ea..925c5af 100644
@@ -1108,11 +1108,11 @@
  * called again.
  */
 static inline void
-compute_earliest_wakeup(interval_t *earliest, interval_t seconds_from_now)
+compute_earliest_wakeup(interval_t *earliest, time_t seconds_from_now)
 {
     if (seconds_from_now < *earliest)
     {
-        *earliest = seconds_from_now;
+        *earliest = (interval_t)seconds_from_now;
     }
     if (*earliest < 0)
     {
@@ -1120,11 +1120,6 @@
     }
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 /*
  * Return true if "lame duck" or retiring key has expired and can
  * no longer be used.
@@ -1786,6 +1781,11 @@
     return true;
 }
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+
 static bool
 write_string(struct buffer *buf, const char *str, const int maxlen)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1299?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6bc3147d10ca50291110335cd9fc3be961280c1b
Gerrit-Change-Number: 1299
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1299?usp=email

to look at the new patch set (#2).

Change subject: ssl: Change update argument of compute_earliest_wakeup to time_t
......................................................................

ssl: Change update argument of compute_earliest_wakeup to time_t

Since we usually input a diff of two time_t values here the input value will be officially time_t. So avoid conversion warnings at almost every caller site.

We can safely cast it to interval_t here because we checked that it is smaller than the interval_t value earliest. And all negative values are treated equal, so exact value doesn't matter.

Change-Id I6bc3147d10ca50291110335cd9fc3be961280c1b

---
M src/openvpn/ssl.c

1 file changed, 8 insertions(+), 8 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/99/1299/2

src/openvpn/ssl.c +8 -8
index 54b69ea..10acd24 100644
@@ -1108,11 +1108,11 @@
  * called again.
  */
 static inline void
-compute_earliest_wakeup(interval_t *earliest, interval_t seconds_from_now)
+compute_earliest_wakeup(interval_t *earliest, time_t seconds_from_now)
 {
     if (seconds_from_now < *earliest)
     {
-        *earliest = seconds_from_now;
+        *earliest = (interval_t)seconds_from_now;
     }
     if (*earliest < 0)
     {
@@ -1120,11 +1120,6 @@
     }
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 /*
  * Return true if "lame duck" or retiring key has expired and can
  * no longer be used.
@@ -1339,7 +1334,7 @@
     /* For now we hardcode this to be 16 for the software based data channel
      * DCO based implementations/HW implementation might adjust this number
      * based on their expected speed */
-    const int future_key_count = 16;
+    const uint8_t future_key_count = 16;
 
     int key_direction = server ? KEY_DIRECTION_INVERSE : KEY_DIRECTION_NORMAL;
     struct key_direction_state kds;
@@ -1786,6 +1781,11 @@
     return true;
 }
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+
 static bool
 write_string(struct buffer *buf, const char *str, const int maxlen)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1299?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6bc3147d10ca50291110335cd9fc3be961280c1b
Gerrit-Change-Number: 1299
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1299?usp=email )

Change subject: ssl: Change update argument of compute_earliest_wakeup to time_t
......................................................................

Patch Set 5: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1299?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6bc3147d10ca50291110335cd9fc3be961280c1b
Gerrit-Change-Number: 1299
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sun, 16 Nov 2025 18:36:09 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#4 lore raw

PATCH v5 1/1 ssl: Change update argument of compute_earliest_wakeup to time_t

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

Since we usually input a diff of two time_t values here the input value will be officially time_t. So avoid conversion warnings at almost every caller site.

We can safely cast it to interval_t here because we checked that it is smaller than the interval_t value earliest. And all negative values are treated equal, so exact value doesn't matter.

Change-Id I6bc3147d10ca50291110335cd9fc3be961280c1b

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1299
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1299
This mail reflects revision 5 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/ssl.c +8 -8
index 7b93ebc..355ab46 100644
@@ -1107,11 +1107,11 @@
  * called again.
  */
 static inline void
-compute_earliest_wakeup(interval_t *earliest, interval_t seconds_from_now)
+compute_earliest_wakeup(interval_t *earliest, time_t seconds_from_now)
 {
     if (seconds_from_now < *earliest)
     {
-        *earliest = seconds_from_now;
+        *earliest = (interval_t)seconds_from_now;
     }
     if (*earliest < 0)
     {
@@ -1119,11 +1119,6 @@
     }
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 /*
  * Return true if "lame duck" or retiring key has expired and can
  * no longer be used.
@@ -1338,7 +1333,7 @@
     /* For now we hardcode this to be 16 for the software based data channel
      * DCO based implementations/HW implementation might adjust this number
      * based on their expected speed */
-    const int future_key_count = 16;
+    const uint8_t future_key_count = 16;
 
     int key_direction = server ? KEY_DIRECTION_INVERSE : KEY_DIRECTION_NORMAL;
     struct key_direction_state kds;
@@ -1785,6 +1780,11 @@
     return true;
 }
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+
 static bool
 write_string(struct buffer *buf, const char *str, const int maxlen)
 {
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: ssl: Change update argument of compute_earliest_wakeup to time_t

Explanation & change make sense. Smoke-tested on Linux.

Your patch has been applied to the master branch.

commit 0e2fc09d4336bd3e87dfb37123ba4df208b1c048

Author: Frank Lichtenheld
Date:   Sun Nov 16 19:36:15 2025 +0100
     ssl: Change update argument of compute_earliest_wakeup to time_t

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1299
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg34482.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#6 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#6) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1299?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: ssl: Change update argument of compute_earliest_wakeup to time_t
......................................................................

ssl: Change update argument of compute_earliest_wakeup to time_t

Since we usually input a diff of two time_t values here the input value will be officially time_t. So avoid conversion warnings at almost every caller site.

We can safely cast it to interval_t here because we checked that it is smaller than the interval_t value earliest. And all negative values are treated equal, so exact value doesn't matter.

Change-Id I6bc3147d10ca50291110335cd9fc3be961280c1b

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1299
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34482.html

---
M src/openvpn/ssl.c

1 file changed, 8 insertions(+), 8 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/99/1299/6

src/openvpn/ssl.c +8 -8
index 2d24f5e..92a68d0 100644
@@ -1107,11 +1107,11 @@
  * called again.
  */
 static inline void
-compute_earliest_wakeup(interval_t *earliest, interval_t seconds_from_now)
+compute_earliest_wakeup(interval_t *earliest, time_t seconds_from_now)
 {
     if (seconds_from_now < *earliest)
     {
-        *earliest = seconds_from_now;
+        *earliest = (interval_t)seconds_from_now;
     }
     if (*earliest < 0)
     {
@@ -1119,11 +1119,6 @@
     }
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 /*
  * Return true if "lame duck" or retiring key has expired and can
  * no longer be used.
@@ -1338,7 +1333,7 @@
     /* For now we hardcode this to be 16 for the software based data channel
      * DCO based implementations/HW implementation might adjust this number
      * based on their expected speed */
-    const int future_key_count = 16;
+    const uint8_t future_key_count = 16;
 
     int key_direction = server ? KEY_DIRECTION_INVERSE : KEY_DIRECTION_NORMAL;
     struct key_direction_state kds;
@@ -1785,6 +1780,11 @@
     return true;
 }
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+
 static bool
 write_string(struct buffer *buf, const char *str, const int maxlen)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1299?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6bc3147d10ca50291110335cd9fc3be961280c1b
Gerrit-Change-Number: 1299
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#7 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1299?usp=email )

Change subject: ssl: Change update argument of compute_earliest_wakeup to time_t
......................................................................

ssl: Change update argument of compute_earliest_wakeup to time_t

Since we usually input a diff of two time_t values here the input value will be officially time_t. So avoid conversion warnings at almost every caller site.

We can safely cast it to interval_t here because we checked that it is smaller than the interval_t value earliest. And all negative values are treated equal, so exact value doesn't matter.

Change-Id I6bc3147d10ca50291110335cd9fc3be961280c1b

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1299
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34482.html

---
M src/openvpn/ssl.c

1 file changed, 8 insertions(+), 8 deletions(-)
src/openvpn/ssl.c +8 -8
index 2d24f5e..92a68d0 100644
@@ -1107,11 +1107,11 @@
  * called again.
  */
 static inline void
-compute_earliest_wakeup(interval_t *earliest, interval_t seconds_from_now)
+compute_earliest_wakeup(interval_t *earliest, time_t seconds_from_now)
 {
     if (seconds_from_now < *earliest)
     {
-        *earliest = seconds_from_now;
+        *earliest = (interval_t)seconds_from_now;
     }
     if (*earliest < 0)
     {
@@ -1119,11 +1119,6 @@
     }
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 /*
  * Return true if "lame duck" or retiring key has expired and can
  * no longer be used.
@@ -1338,7 +1333,7 @@
     /* For now we hardcode this to be 16 for the software based data channel
      * DCO based implementations/HW implementation might adjust this number
      * based on their expected speed */
-    const int future_key_count = 16;
+    const uint8_t future_key_count = 16;
 
     int key_direction = server ? KEY_DIRECTION_INVERSE : KEY_DIRECTION_NORMAL;
     struct key_direction_state kds;
@@ -1785,6 +1780,11 @@
     return true;
 }
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+
 static bool
 write_string(struct buffer *buf, const char *str, const int maxlen)
 {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1299?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6bc3147d10ca50291110335cd9fc3be961280c1b
Gerrit-Change-Number: 1299
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>